<%@page import="front.SubForum"%>
<%@ page language="java" contentType="text/html; charset=ISO-8859-1"
    pageEncoding="ISO-8859-1"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
<title>Create new Thread</title>
</head>
<body>
	<div style="float:right;margin-left:auto;margin-right:0px;">
	<%@ include file="LoginForm.jsp" %>
	</div>
	<%@ taglib prefix="c" uri="http://java.sun.com/jstl/core_rt" %>
	<jsp:useBean class="front.SubForum" id="s" scope="page"/>
	<c:set target="${s}" property="subForumID" value="${param.subForumID}"/>
	<c:choose>
		<c:when test="${not empty sessionScope.user}">
		<c:set var="action" value="createThread" />
		<form action="ForumController" method="get">
			<table>
				<tr>
					<td>SubForum:</td><td><input type="text" name="subForumName" value="${s.name}" READONLY></td>
							<input type="hidden" name="subForumID" value="${param.subForumID}" READONLY>
				</tr>
				<tr>
					<td>Name:</td><td><input type="text" name="name" value="${sessionScope.retName }"></td>
					<c:remove var="retName" scope="session"/>
					<td>
						<c:if test="${not empty sessionScope.noName}">
							<c:remove var="noName" scope="session"/>
								<div style="color:red">No name!</div>
						</c:if>
					</td>
							<input type="hidden" name="action" value="createThread">
				</tr>
			</table>
		 	Content:	<br>
		 	<textarea id="content" name="content" 
						style="position:inherit;height:263px;width:445px;overflow:auto;font-family:Times New Roman;font-size:100%;"><c:if test="${not empty sessionScope.retCont }">${sessionScope.retCont}<c:remove var="retCont" scope="session"/></c:if></textarea>
			<c:if test="${not empty sessionScope.noCont}">
				<c:remove var="noCont" scope="session"/>
				<div style="color:red">No Content!</div>
			</c:if>
			<br>
			<input type="submit" value="Create Thread!" />
		</form>
	</c:when>
	<c:otherwise>
		<p>You need to login to be able to post new threads!</p>
	</c:otherwise>
	</c:choose>
	

</body>
</html>